﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AutoWindowsSize; //窗口自适应

namespace h1
{
    public partial class Form_confirm : Form
    {
        Form_setMibao f0;
        Form_user f1;
        Form1 f2;
        int type;
        AutoAdaptWindowsSize AutoSize; //窗口自适应
        public Form_confirm()
        {
            InitializeComponent();
        }
        public Form_confirm(Form_setMibao f,string message, string conText)
        {
            InitializeComponent();
            label1.Text = conText;
            label2.Text = message;
            f0 = f;
            type = 0;
        }
        public Form_confirm(Form_user f, string message, string conText)
        {
            InitializeComponent();
            label1.Text = conText;
            label2.Text = message;
            f1 = f;
            type = 1;
        }
        public Form_confirm(Form1 f, string message, string conText)
        {
            InitializeComponent();
            label1.Text = conText;
            label2.Text = message;
            f2 = f;
            type = 2;
        }
        private void Form_confirm_Load(object sender, EventArgs e)
        {
            AutoSize = new AutoAdaptWindowsSize(this);//窗口自适应
        }

        private void button1_Click(object sender, EventArgs e)
        {
            switch (type)
            {
                case 0:
                    f0.confirm = true;
                    break;
                case 1:
                    f1.confirm = true;
                    break;
                case 2:
                    f2.confirm = true;
                    break;
                default: 
                    f0.confirm = true; 
                    break;
            }
            
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            switch (type)
            {
                case 0:
                    f0.confirm = false;
                    break;
                case 1:
                    f1.confirm = false;
                    break;
                case 2:
                    f2.confirm = false;
                    break;
                default:
                    f0.confirm = false;
                    break;
            }
            this.Close();
        }

        private void Form_confirm_SizeChanged(object sender, EventArgs e)
        {
            if (AutoSize != null)
            {
                AutoSize.FormSizeChanged();
            }
        }
    }
}
